using UnityEngine;
using UnityEngine.UI;

public class StampShaderController : MonoBehaviour
{
    public Image targetImage; // assign the UI Image
    private Material mat;

    public void ApplyStamp(Sprite sprite, string seedWord)
    {
        if (mat == null)
        {
            mat = new Material(Shader.Find("Zoo/StampShader"));
        }

        targetImage.material = mat;
        targetImage.sprite = sprite;

        // stable seed based on animal name
        float seed = 0;
        foreach (char c in seedWord)
            seed += (int)c * 1.2345f;

        mat.SetFloat("_Seed", seed);
        mat.SetFloat("_TintStrength", 0.45f);
    }
}
